package com.soxing.webrain.brush.common.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringUtils {

	/**
	 * 特殊字符过滤正则表达式
	 */
	private static String SPECIAL_CHAR_REGEX = "[^a-zA-Z0-9\\-_.\\u4e00-\\u9fa5]";

	public static String removeSpecialChar(String str) {
		if (str == null || "".equals(str.trim())) {
			return str;
		}
		Pattern pattern = Pattern.compile(SPECIAL_CHAR_REGEX);
		Matcher matcher = pattern.matcher(str);
		if (matcher.find()) {
			str = matcher.replaceAll("");
		}
		return str;
	}
	
	public static void main(String[] args) {
		String str = "热搜A b _- C ** 33() ";
		str = removeSpecialChar(str);
		System.out.println(str);
	}
	
}
